var e, t = require("../../../@babel/runtime/helpers/interopRequireDefault")(require("../../../@babel/runtime/regenerator")), r = require("../../../@babel/runtime/helpers/asyncToGenerator"), o = require("../common").getProjectNameLang, a = require("../../../mybehaviors/location/location"), n = getApp(), i = n.getNetAddresss("plugin.store-projects.frontend.project.get-detail"), c = null;

Page({
    behaviors: [ a ],
    data: {
        projectId: null,
        project: null,
        stores: [],
        goods: [],
        projectNameLang: o()
    },
    onLoad: (e = r(t.default.mark(function e(r) {
        var a = this;
        return t.default.wrap(function(e) {
            for (;;) switch (e.prev = e.next) {
              case 0:
                if (r.project_id) {
                    e.next = 4;
                    break;
                }
                return wx.showToast({
                    title: o() + "不存在",
                    icon: "none"
                }), wx.navigateBack(), e.abrupt("return");

              case 4:
                this.setData({
                    projectId: r.project_id
                }), this._getLocation(function(e, t) {
                    c = c = {
                        point: t
                    }, a.getProject();
                });

              case 6:
              case "end":
                return e.stop();
            }
        }, e, this);
    })), function(t) {
        return e.apply(this, arguments);
    }),
    onReady: function() {},
    onShow: function() {},
    onShareAppMessage: function() {
        return {
            path: "/packageH/project_verification/VerificationProjectDetails/VerificationProjectDetails?project_id=" + this.data.projectId
        };
    },
    onShareTimeline: function() {
        return {
            query: "project_id=" + this.data.projectId
        };
    },
    btnStore: function(e) {
        var t = e.currentTarget.dataset.item;
        2 == t.store_type ? wx.redirectTo({
            url: "/packageC/hotel/HotelHome/HotelHome?id=" + t.id
        }) : wx.redirectTo({
            url: "/packageC/o2o/HomeSeller/HomeSeller?store_id=" + t.id
        });
    },
    getProject: function() {
        var e = this, t = n.qqMapTransBMap(parseFloat(c.point.lng), parseFloat(c.point.lat));
        n._getNetWork({
            url: i,
            data: {
                lng: t.lng,
                lat: t.lat,
                project_id: this.data.projectId
            },
            success: function(t) {
                var r = t.data.data, o = t.result, a = t.msg;
                if (0 === o) return wx.showToast({
                    title: a,
                    icon: "none"
                }), void wx.navigateBack();
                e.setData({
                    project: r.project,
                    stores: r.store,
                    goods: r.goods
                });
            }
        });
    }
});